/**
 * Copyright (C), 2015-2021, XXX有限公司
 * FileName: Launch
 * Author:   wanglm
 * Date:     2021-7-19 16:52
 * Description:
 * History:
 * <author>          <time>          <version>          <desc>
 * 作者姓名           修改时间           版本号              描述
 */
package com.jb20210719.myapp;

import org.jb2011.lnf.beautyeye.BeautyEyeLNFHelper;
import org.jb2011.lnf.beautyeye.utils.Platform;

import javax.swing.PopupFactory;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;


/**
 * 〈一句话功能简述〉<br> 
 * 〈〉
 *
 * @author wanglm
 * @create 2021-7-19
 * @since 1.0.0
 */
public class Launch {
    private static void initUserInterface() {
        System.setProperty("apple.laf.useScreenMenuBar", "true");
        System.setProperty(
                "com.apple.mrj.application.apple.menu.about.name",
                "Draw 9-patch");

        try {
            if(Platform.isWindows())
            {
                UIManager.put("RootPane.setupButtonVisible", false);
                BeautyEyeLNFHelper.translucencyAtFrameInactive = false;
                BeautyEyeLNFHelper.launchBeautyEyeLNF();

                // impl a demo PopupFactory
//                PopupFactory.setSharedInstance(new CoolPopupFactory());
            }
            else {
                UIManager.setLookAndFeel(UIManager
                        .getSystemLookAndFeelClassName());
            }
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        } catch (InstantiationException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        } catch (UnsupportedLookAndFeelException e) {
            e.printStackTrace();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public static void main(final String... args) {
        initUserInterface();
        SwingUtilities.invokeLater(new Runnable() {
            @Override
            public void run() {
                String arg = args.length > 0 ? args[0] : null;
                MainFrame frame = new MainFrame(arg);
                frame.setDefaultCloseOperation(MainFrame.EXIT_ON_CLOSE);
                frame.setLocationRelativeTo(null);
                frame.setVisible(true);
            }
        });
    }
}
